package login.processor;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import lion.common.MsgCodeAnn;
import lion.netty4.codec.ProtoUtil;
import lion.netty4.message.GamePlayer;
import lion.netty4.message.MyRequestMessage;
import lion.netty4.message.RequestMessageRaw;
import lion.netty4.message.RequestProtoMessage;
import lion.netty4.processor.MsgProcessor;
import login.logic.LoginAccountManager;
import login.stat.LoginStat;
import lua.LuaMessageLogin.C2SGuestLogin;

@MsgCodeAnn(msgcode = C2SGuestLogin.id, accessLimit = 200)
public class GuestLoginProcessor extends MsgProcessor {

	private static Logger logger = LoggerFactory.getLogger(GuestLoginProcessor.class);

	private LoginAccountManager loginAccountManager = LoginAccountManager.getInstance();

	@Override
	public void process(GamePlayer player, RequestMessageRaw request) throws Exception {
		C2SGuestLogin garenaLogin = C2SGuestLogin.parse(request);
		int accountId = garenaLogin.accountId;
		logger.info("1005-guest-login,accountId={}", accountId);
		LoginStat.getInstance().saveLoginTime(String.valueOf(accountId));
		loginAccountManager.guestLogin(player, accountId);
	}

	@Override
	public void process(GamePlayer player, RequestProtoMessage request) throws Exception {
		
	}

	@Override
	public void process(GamePlayer session, MyRequestMessage request) throws Exception {
		// TODO Auto-generated method stub
		
	}

}
